package robotleMvc.ui
{
	import com.ui.manager.UIManager;
	import com.utils.ItemCssType;
	
	import flash.text.AntiAliasType;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	import flash.text.TextFormatAlign;
	import flash.text.StyleSheet;

	public class TextUtil
	{
		public function TextUtil()
		{
		}
		public static function getTextField( textformat:TextFormat = null, defultFilters:Boolean = true, width:uint = 0, isCenter:Boolean = false, multiline:Boolean = false, size:uint = 0, mouseEn:Boolean = false, styleSheet:StyleSheet = null ):TextField
		{
			var textField:TextField = UIManager.getTextField();
			textField.antiAliasType = AntiAliasType.ADVANCED;

			textField.multiline = multiline;
			textField.filters = defultFilters ? UIManager.getEdgeFilters( 0x000000, .7 ) : null;
			var thistextformat:TextFormat;
			if (textformat == null)
			{
				thistextformat = UIManager.getTextFormat();
				if (multiline) thistextformat.leading = 2;
				if (size)
					thistextformat.size = size;
				if (isCenter)
					thistextformat.align = TextFormatAlign.CENTER;
				textField.defaultTextFormat = thistextformat;
			}
			else
				textField.defaultTextFormat = textformat;
			if (!styleSheet)
			{
				textField.styleSheet = ItemCssType.css();
			
			}
			else
			{
				textField.styleSheet = styleSheet;
			}
			textField.mouseEnabled = mouseEn;
			textField.selectable = false;
			// textField.multiline = true;
			if (width != 0)
			{
				textField.width = width;
				textField.wordWrap = true;
			}
			isCenter == true ? textField.autoSize = TextFieldAutoSize.CENTER : textField.autoSize = TextFieldAutoSize.LEFT;
			return textField;

		}
	}
}